package com.SprintTest.AnnotationTest;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javaconfig.Person;
import javaconfig.Car;
import javaconfig.AppConfig;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
    	// 由于是XML配置方式，对应的Spring容器是ClassPathXmlApplicationContext,传入配置文件告知Spring去哪读取配置信息
    	AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);
    	applicationContext.start();
        // 从容器中获取Person
        Person person = (Person) applicationContext.getBean("person");
        person.toString();
        System.out.println(person);
        System.out.println( "Hello World!" );
        applicationContext.stop();
        applicationContext.close();  
    }
}
